package com.sskj.ident.presenter;

import com.lzy.okgo.OkGo;
import com.lzy.okgo.model.Response;
import com.sskj.common.base.HttpData;
import com.sskj.common.util.ToastUtil;
import com.sskj.ident.http.HttpConfig;
import com.sskj.ident.ui.activity.VerificationSecondActivity;
import com.sskj.lib.http.JsonCallBack;

import java.io.File;


public class VerificationSecondActivityPresenter extends BasePresenter<VerificationSecondActivity> {


    /**
     * 高级认证
     *
     * @param front_img 身份证正面

     * @param back_img 身份证反面

     * @param handheld_img 手持身份证照


     * @return
     */
    public void apiAuthenticationAdvancedcertification(String front_img,String back_img,String handheld_img) {
        httpService.apiAuthenticationAdvancedcertification(front_img,back_img,handheld_img).execute(new JsonCallBack<HttpData>(this) {
            @Override
            public void onSuccess(Response<HttpData> response) {
                HttpData httpData = response.body();
                ToastUtil.showShort(httpData.getMsg());
                if (httpData.getStatus() == HttpConfig.OK) {
                    mView.certificationSuccess();
                }
            }
        });
    }
    public void submitVerify(File file) {
        OkGo.<HttpData<String>>post(HttpConfig.BASE_URL + HttpConfig.HIGH_VERIFY_IMG)
                .isMultipart(false)
                .params("file", file)
                .execute(new JsonCallBack<HttpData<String>>(this) {
                    @Override
                    public void onSuccess(Response<HttpData<String>> response) {
                        HttpData<String> body = response.body();
                        if (body.getStatus() == HttpConfig.OK) {
                            mView.uploadSuccess();
                        }
                    }
                });
    }
}
